<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./promise.js"></script>
</head>
<body>
    <h1>自定义Promise--为Promise添加catch方法</h1>
    <script>
        // 使用自定义的Promise
        const p = new Promise((resolve, reject)=>{
            reject("error");
        });

        const p2 = p.catch(reason => {
            console.log("失败：", reason);
            //return "no"        
            throw "出错误了"
        })
        

        console.log(p2);

        

    </script>
</body>
</html>